import sys
import pylab as plt
import os
from params import *

file = os.path.join("results","gap_params.txt")
file = os.path.join(os.path.join(WORKDIR, 'gowalla', 'temporal',"gap_params.txt"))

degrees = []
alpha = []
th = []
averages = []
MAX_D = 100
for line in open(file):
    d,a,b,c,avg = map(float,line.strip().split())
    if d > MAX_D:
        continue
    degrees.append(d)
    alpha.append(a)
    th.append(b)
    averages.append(avg)


plt.figure()
plt.clf()
plt.axes(FIG_AXES2)
plt.plot(degrees,alpha,'ko',mfc='None')
plt.xlabel(r'$k$')
plt.ylabel(r'$\alpha_k$')
plt.grid(True)
plt.ylim((0,1))
plt.savefig('gap_alpha.pdf')
plt.close()

plt.figure()
plt.clf()
plt.axes(FIG_AXES2)
plt.plot(degrees,th,'ko' ,mfc="None")
plt.xlabel(r'$k$')
plt.ylabel(r'$\beta_k$')
plt.grid(True)
plt.savefig('gap_beta.pdf')
plt.close()

plt.figure()
plt.clf()
plt.axes(FIG_AXES2)
plt.plot(degrees,averages,'ko',mfc="None")
plt.xlabel(r'$k$')
plt.ylabel(r'$\langle \delta(k) \rangle$')
plt.grid(True)
plt.savefig('gap_avg.pdf')
plt.close()
